function Room(roomid)
{
  this.roomid = String(roomid);
  this.getBldg = function()
  {
    return allBldgs[this.bldgid];
  };
}

function newRoom(roomid)
{
  return new Room(roomid);
}

Room.prototype.getFullText = function()
{
  if (!(this.fullText))
  {
    this.fullText = "";
    this.fullText += this.getBldg().name + this.name + this.type;

    this.fullText = this.fullText.toLowerCase();
  }
  return this.fullText;
};

function Bldg(bldgid)
{
  this.bldgid = String(bldgid);
}

function newBldg(bldgid)
{
  return new Bldg(bldgid);
}

Bldg.prototype.getAllRooms = function()
{
  if (!(this.allMyRooms))
  {
    this.allMyRooms = {};
    for (roomid in allRooms)
    {
      var room = allRooms[roomid];
      if (room.bldgid == this.bldgid)
      {
        this.allMyRooms[roomid] = allRooms[roomid];
      }
    }
  }
  return this.allMyRooms;
};

Bldg.prototype.getVisRooms = function()
{
  var allMyRooms = this.getAllRooms();
  var rooms = {};
  for (roomid in allMyRooms)
  {
    if (roomid in visRooms)
    {
      rooms[roomid] = visRooms[roomid];
    }
  }
  return rooms;
};